﻿
CREATE PROCEDURE [dbo].[amix_ActSeriiNumerice] 
	-- Add the parameters for the stored procedure here
	@IDSerie varchar(20),@CodUnitate smallint
AS
BEGIN
	SET NOCOUNT ON;
	UPDATE [SeriiNumerice] SET UltimulNrFolosit = dbo.GetFinalNumber((SELECT MAX(NrInventar) FROM [AmixRegistru] WHERE [CodUnitate]=@CodUnitate))+1,
		[UltimaDataFolosit]  = GETDATE(),
		Serie = SUBSTRING(dbo.GetFinalNumberAntet((SELECT MAX(NrInventar) FROM [AmixRegistru] WHERE [CodUnitate]=@CodUnitate)),1,10)
	 
	WHERE [CodUnitate]=@CodUnitate AND [IdSerie]=@IdSerie		
END